<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>视频类型</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="author" content="Bluth Company">
    <link rel="shortcut icon" href="__STATIC__/admin/assets/ico/favicon.html">
    <link href="__STATIC__/admin/assets/css/bootstrap.css" rel="stylesheet">
    <link href="__STATIC__/admin/assets/css/theme.css" rel="stylesheet">
    <link href="__STATIC__/admin/assets/css/font-awesome.min.css" rel="stylesheet">
    <link href="__STATIC__/admin/assets/css/alertify.css" rel="stylesheet">
    <link rel="Favicon Icon" href="favicon.ico">
 
  </head>
  <body>
  <div id="wrap">
   {include file="public:header" /}

    <div class="container-fluid">
    {include file="public:sidemenu" /}
            <!-- Main window -->
      <div class="main_container" id="users_page">

        <div class="row-fluid">
          <ul class="breadcrumb">
            <li><a href="#">首页</a> <span class="divider">/</span></li>
            <li class="active">类型管理</li>
          </ul>

        <div class="row-fluid">
          <div class="widget widget-padding span12">
            <div class="widget-header">
              <i class="icon-group"></i>
              <h5>类型列表</h5>
              <div class="widget-buttons">
                  <a href="#" data-title="Add User" data-toggle="modal" data-target="#example_modal"><i class="icon-plus"></i></a>
                  <a href="#" data-title="Collapse" data-collapsed="false" class="collapse"><i class="icon-chevron-up"></i></a>
              </div>
            </div>  
            <div class="widget-body">
              <table id="users" class="table table-striped table-bordered dataTable">
                <thead>
                  <tr>
                    <th>编号</th>
                    <th>类型名</th>
                    <th></th>
                  </tr>
                </thead>
                <tbody>

{volist name="videotype" id="vo"}

                  <tr>
                    <td>{$i}</td>
                    <td>
                        {$vo.typename}
                    </td>
                    <td>
                      <div class="btn-group">
                        <a class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#">
                        	操作
                          <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu pull-right">
                          <li><a href="#" data-toggle="modal" data-target="#edit_modal" onclick="jsedit({$vo.tid})"><i class="icon-edit"></i> 修改</a></li>
                          <li><a href="{:url('delete',['id'=>$vo.tid])}"><i class="icon-trash"></i> 删除</a></li>
                        </ul>
                      </div>
                    </td>
                  </tr>
    {/volist}              
                </tbody>
              </table>
            </div> <!-- /widget-body -->
          </div> <!-- /widget -->
        </div> <!-- /row-fluid -->

      </div>
      <!-- /Main window -->

    </div><!--/.fluid-container-->
    </div><!-- wrap ends-->

     <!-- Example Modal -->
    <div id="example_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="myModalLabel">添加视频类型</h3>
      </div>
      <div class="modal-body">
        <p>
        <form method="POST" action="{:url('add')}" >
        <input type="text" placeholder="typename" name="typename">
        <div style="margin-left: 220px;margin-top: -40px;">
       <button class="btn btn-primary" type="submit">添加</button>
       </div>
        </form>
        </p>
      </div>
    </div>  
    <!-- Example Modal -->
    <div id="edit_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="myModalLabel">修改视频类型</h3>
      </div>
      <div class="modal-body">
        <p>
        <form method="POST" action="{:url('videotype/update')}" >
        <input type="hidden" name="tid" id="tida">
        <input type="text" placeholder="typename" name="typename" id="typenamea">
        <div style="margin-left: 220px;margin-top: -40px;">
       <button class="btn btn-primary" type="submit">修改</button>
       </div>
        </form>
        </p>
      </div>
     
    </div> 
     

    </div>  
    {include file="public:footer" /}
 <script>
        function jsedit(tid){
          //从数据库中根据tid获取记录
          $.getJSON("{:url('videotype/edit')}",{"tid":tid},function(json){ 

            //显示在模态框中
            $("#tida").val(json.tid);
            $("#typenamea").val(json.typename);}

            );
        }

    </script>

    </body>
</html>
